import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:online_bookstore/constants/app_theme.dart';
import 'package:online_bookstore/screens/splash_screen.dart';
import 'package:online_bookstore/services/storage_service.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  // Initialize storage service
  await StorageService().initialize();
  
  runApp(
    const ProviderScope(
      child: OnlineBookstoreApp(),
    ),
  );
}

class OnlineBookstoreApp extends ConsumerWidget {
  const OnlineBookstoreApp({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    return MaterialApp(
      title: 'Online Bookstore',
      debugShowCheckedModeBanner: false,
      theme: AppTheme.lightTheme,
      darkTheme: AppTheme.darkTheme,
      themeMode: ThemeMode.system,
      home: const SplashScreen(),
    );
  }
}
